<?php
namespace Services\Api;
use Common\Models\FLiveCategory;
use Common\Models\FUsersExtend;
use Services\ServicesApiBase;
class LiveServices extends ServicesApiBase {


    /**
     * 获取生活分类列表
     */
    public function category($type,$pid){
        $FLiveCategoryDb = new FLiveCategory();
        $result = $FLiveCategoryDb->category($type,$pid);
        if($pid==1){
//            $tempResult = ["category_id"=>-1,"category_name"=>"红包商家","cate_id"=>"-1"];
            $firstResult['category_name'] = "全部";
            $firstResult['cate_id'] = "43433";
            array_unshift($result,$firstResult);
        }else{
            $firstResult['category_name'] = "全部";
            $firstResult['cate_id'] = "43435";
            array_unshift($result,$firstResult);
        }
        return $result;
    }

    /**
     * 根据分类获取物料
     */
    public function get_list($user_info,$params){
        $tb_rid = isset($user_info['tb_rid']) && !empty($user_info['tb_rid']) ? $user_info['tb_rid'] : '';
        $tb_sid = isset($user_info['tb_special_id']) && !empty($user_info['tb_special_id']) ? $user_info['tb_special_id'] : '';
        if($params['cate_id'] != '-1'){
            $responseResult = $this->taobao->dgMaterialOptional($params,$tb_rid,$tb_sid);
        }else{
            $responseResult = $this->taobao->elemePromotionStorepromotionQuery($params);
        }
        return $responseResult;
    }


    /**
     * 美团分类列表
     */
    public function cityCate(){
        return $this->jutuike->cityCate(45);
    }


    /**
     *
     *团购店铺/商品列表 请求三次接口
     */
    public function searchDeals($sid, $cat0Id, $lng, $lat, $page, $pageSize, $dealType, $sortType, $radii, $cat1Ids, $keywords,$cityId)
    {
        $data = $this->jutuike->searchDeals($sid, $cat0Id, $lng, $lat, $page, $pageSize, $dealType, $sortType, $radii, $cat1Ids, $shopIds = '', $keywords, $del_repeat = 2, $cityId);
        return $data;
    }


    public function shopDetail($params){
        $response = $this->jutuike->searchDeals(0,$params['cat0Id'],$params['longitude'],$params['latitude'],$params['page'],$params['pageSize'],$params['dealType'],$params['sortType'],$params['radii'],$params['cat1Ids'],$params['shopIds'],0);
        return $response;
    }

}